package com.ronghui.cash.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.ronghui.cash.entity.UserMsg;
import com.ronghui.cash.mapper.UserMsgMapper;
import com.ronghui.cash.service.UserMsgService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户消息表 服务实现类
 * </p>
 *
 * @author wiki
 * @since 2017-12-04
 */
@Service
public class UserMsgServiceImpl extends ServiceImpl<UserMsgMapper, UserMsg> implements UserMsgService {

    @Autowired
    UserMsgService userMsgService;

    @Autowired
    UserMsgMapper userMsgMapper;
    @Override
    public Page<UserMsg> updateAndGetlistByUserId(Page<UserMsg> page, Long userId) {
        page = userMsgService.selectPage(page, new EntityWrapper<UserMsg>().eq("user_id", userId).orderBy("create_time",false));
        return page;
    }

    @Override
    public int updateNewByUserId(Long userId) {
        return userMsgMapper.updateNewByUserId(userId);
    }
}
